#ifndef CT_RABBITMQ_PULL_THREAD_H_
#define CT_RABBITMQ_PULL_THREAD_H_

#include "ctRWLock.h"
#include <stdint.h>
#include "ct_thread.h"
#include "amqp.h"

class AMQPPullThread:
        public ctThread
{
        public:
                virtual ~AMQPPullThread();
                void init(const std::string &host, 
                                const uint16_t &port, 
                                const std::string &user, 
                                const std::string &pswd, 
                                const std::string &vhost,
                                const std::string &exchange, 
                                const std::string &queue,
                                const std::string &routingkey);
                void run();
                virtual bool msg_parse(const std::string &msg) = 0;

        private:
                void loop_pull_msg(amqp_connection_state_t conn);

                std::string hostname_;
                uint16_t port_;
                std::string vhost_;
                std::string user_;
                std::string passwd_;
                std::string exchange_;
                std::string queue_;
                std::string routingkey_;
};

#endif
